Skip to content

Refresh active playlists during song preview#1305

Open
dgruss wants to merge 1 commit into
UltraStar-Deluxe:masterfrom
dgruss:reloadplaylists
Open

Refresh active playlists during song preview#1305
dgruss wants to merge 1 commit into
UltraStar-Deluxe:masterfrom
dgruss:reloadplaylists

Conversation

@dgruss

@dgruss dgruss commented May 15, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces a mechanism for automatically and efficiently reloading the current playlist in the song selection screen, ensuring that the playlist view stays up-to-date with underlying changes (such as file modifications), especially after a song preview ends. It also refactors playlist application logic for improved code clarity and maintainability.

Playlist Reloading and Application Enhancements:

  • Added a new method ReloadCurrentPlaylist to TScreenSong, which reloads and reapplies the current playlist if necessary, preserving song selection and preview state when possible, and throttling reloads to avoid excessive operations. This method is now called on each draw cycle and after music preview ends. [1] [2] [3] [4]
  • Introduced two new fields, LastPlaylistReloadTime and PreviewEndReloaded, to TScreenSong to track reload timing and prevent redundant reloads after preview ends. These are properly initialized and reset in relevant lifecycle events. [1] [2] [3] [4] [5]
  • Defined a reload interval constant (PLAYLIST_RELOAD_INTERVAL_MS) to throttle automatic playlist reloads.

Playlist Management Refactoring:

  • Refactored playlist application logic: extracted the logic from SetPlayList into a new function ApplyPlayList in TPlayListManager for better separation of concerns and reusability. SetPlayList now calls ApplyPlayList and only proceeds if successful. [1] [2] [3]
  • Ensured that playlist file modification times are correctly updated after saving and when loading, by referencing the correct filename variable. [1] [2]

These changes collectively improve the user experience by keeping the playlist view in sync with underlying data changes, while also making the codebase more modular and maintainable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant